package com.xinshi.school;
public class Student{
    private String studentld;
    private String name;
    private int age;
    private String major;
    public Student(){

    }
    public Student(String studentld,String name,int age,String major){
        this.studentld=studentld;
        this.name=name;
        this.age=age;
        this.major=major;
    }
    public void setter(String studentld,String name,int age,String major){
        this.studentld=studentld;
        this.name=name;
        this.age=age;
        this.major=major;
        if((this.age<15||this.age>40)||this.studentld==null)
            System.out.println("error!");
    }
    public  void showInfo(){
        System.out.println("学号："+this.studentld+"姓名："+this.name+"年龄："+this.age+"职业："+this.major);
    }
    public void updataMajor(String newMajor){
        this.major=newMajor;
    }
    public void isAgeValid(){
        if(this.age<15||this.age>40)
            System.out.println("error!");
        else
            System.out.println("is ok!");
    }
}
